<%--
    Document   : index
    Created on : Mar 10, 2014, 10:54:45 PM
    Author     : Anton Strack
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="csd" tagdir="/WEB-INF/tags" %>
<csd:displayResultMessage></csd:displayResultMessage>
<article id="${bean.id}">
    <div class="panel-heading"><h3 class="panel-title"><a href="${req.contextPath}?view=${bean.id}">${bean.name}</a></h3></div>
    <div class="panel-body">
        <p class="csd_description">
            ${bean.description}
        </p>
        <p>
            ${bean.body}
        </p>
    </div>
    <div class="panel-footer">
        <%@include file="/category/_postCategories.jsp" %>
        <p>Created By: ${bean.getDerivedValue("CreatedByName")} on ${bean.createdDate}
            <c:if test="${bean.createdDate != bean.updatedDate}">
                and updated
                <c:if test="${bean.updatedById != bean.createdById}">
                    by: ${bean.getDerivedValue("UpdatedByName")}
                </c:if>
                on ${bean.updatedDate}
            </c:if>
        </p>
        <p><a href="${req.contextPath}?action=update&resource=plot&amp;id=${bean.id}">Update ${bean.getDerivedValue("ResourceTypeName")}</a> | <a href="${req.contextPath}?action=delete&resource=plot&amp;id=${bean.id}">Delete ${bean.getDerivedValue("ResourceTypeName")}</a>
            <c:if test="${bean.parentId != 0}"><%-- 0 means there isn't a previous version of this post --%>
                | <a href="${req.contextPath}?action=view&resource=plot&amp;id=${bean.parentId}">Read prior version</a>
            </c:if>
            | <a href="${req.contextPath}?action=add&amp;resource=category&amp;for=${fn:toLowerCase(bean.getDerivedValue('ResourceTypeName'))}&amp;id=${bean.id}">Add Categories</a>
        </p>
    </div>
    <div class="csd_comments">
        <c:choose>
            <c:when test="${comments == null}">
                <header class="csd_comment_title">No comments yet.</header>
                </c:when>
                <c:otherwise>
                <header class="csd_comment_title">${comments.size()} Comments</header>
                    <%@include file="/comment/_index.jsp" %>
                </c:otherwise>
            </c:choose>
    </div>
    <div class="csd_comment_form_area">
        <%@include file="/comment/_create.jsp" %>
    </div>
</article>
